package day13;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author Xiao
 * @date 2021/8/6
 */
public class ThreadDemo01 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc1 = new MyCallable();
        MyCallable mc2 = new MyCallable();
        FutureTask<String> ft1 = new FutureTask<>(mc1);
        FutureTask<String> ft2 = new FutureTask<>(mc2);
        Thread t1 = new Thread(ft1);
        Thread t2 = new Thread(ft2);
        t1.setName("阿良");
        t2.setName("左右");
        t1.start();
        t2.start();
        System.out.println(ft1.get());
        System.out.println(ft2.get());
    }
}
